package com.novel.mapper;

import com.novel.pojo.system.User;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;

//继承通用mapper，让通用mapper帮我们创建基本的sql语句
public interface UserMapper extends Mapper<User>, MySqlMapper<User> {

    //根据邮箱查询用户信息
    User selectByEmail(String email);

    //根据邮箱更新用户密码
    int updatePasswordByEmail(@Param("user") User user);

    //根据用户id增加用户推荐票数量
    int updateUserRecommendByUserId(@Param("userIds") List<String> userIds, @Param("amount") Integer amount);

    //增加作者稿酬收入
    int updatedAuthorIncomeByAuthorId(@Param("authorId") String authorId, @Param("income") Double income);

    //更新用户权限
    int updateUserPermission(@Param("userId") String userId, @Param("permission") Integer permission);
}
